const baseViews = [  //基本的路由
    {
        name:'home',
        path: '/',
        component: () => import(/* webpackChunkName: "home" */ '@/views/index.vue'),
        meta: {keepAlive:true}
    },
    {
        name:'goodsDetail',
        path: '/goods/detail',
        props:true,
        component: () => import(/* webpackChunkName: "home" */ '@/views/goods/detail.vue'),
        meta: {title:'商品详情'}
    },
    {
        name:'cart',
        path: '/cart',
        component: () => import(/* webpackChunkName: "home" */ '@/views/cart.vue'),
        meta: {keepAlive:true,title:'采购车'}
    },
    {
        name:'cart2',
        path: '/cart2',
        component: () => import(/* webpackChunkName: "home" */ '@/views/cart.vue'),
        meta: {keepAlive:true,title:'采购车'}
    },
    {
        name:'userCenter',
        path: '/user',
        component: () => import(/* webpackChunkName: "home" */ '@/views/user/index.vue'),
        meta: {keepAlive:true,title:'个人中心'}
    },
    {
        name:'404',
        path: '/error/404',
        component: () => import(/* webpackChunkName: "404" */ '@/views/error/404.vue'),
        meta: {keepAlive:true,title:'出错啦~'}
    },
    {
        name:'403',
        path: '/error/403',
        component: () => import(/* webpackChunkName: "401" */ '@/views/error/403.vue'),
        meta: {keepAlive:true,title:'出错啦~'}
    },
    {
        name:'500',
        path: '/error/500',
        component: () => import(/* webpackChunkName: "401" */ '@/views/error/403.vue'),
        meta: {keepAlive:true,title:'出错啦~'}
    },
    { path: '/:pathMatch(.*)*', redirect:'/error/404' },// 如果你省略了最后的 `*`，在解析或跳转时，参数中的 `/` 字符将被编码

]

const shopViews = [  //店铺模块的路由
    {
        path: '/shop',
        component: () => import(/* webpackChunkName: "home" */ '@/layout/shopLayer.vue'),
        meta: {keepAlive:true,title:'商城店铺',routerViewKey: 'shop-page'},  //避免嵌套路由二级父组件重新渲染
        redirect:'/shop/home',
        children:[
            {
                name:'shopIndex',
                path: '/shop/home',
                component: () => import(/* webpackChunkName: "home" */ '@/views/shop/home.vue'),
                props:true,
                meta: {title:'沃易购店铺',routerViewKey: 'shop-page'}  //避免嵌套路由二级父组件重新渲染
            },
            {
                name:'shopSearch',
                path: '/shop/search',
                component: () => import(/* webpackChunkName: "home" */ '@/views/shop/search.vue'),
                props:true,
                meta: {title:'本店商品',routerViewKey: 'shop-page'}  //避免嵌套路由二级父组件重新渲染
            },
            {
                name:'shopCategory',
                path: '/shop/category',
                component: () => import(/* webpackChunkName: "home" */ '@/views/shop/category.vue'),
                props:true,
                meta: {title:'店铺商品分类',routerViewKey: 'shop-page'}  //避免嵌套路由二级父组件重新渲染
            },
            {
                name:'shopCredit',
                path: '/shop/credit',
                component: () => import(/* webpackChunkName: "home" */ '@/views/shop/credit.vue'),
                props:true,
                meta: {title:'店铺信息',routerViewKey: 'shop-page'}  //避免嵌套路由二级父组件重新渲染
            },
            {
                name:'shopSearchInputKey',
                path: '/shop/search/inputKey',
                component: () => import(/* webpackChunkName: "home" */ '@/views/shop/shopInputKey.vue'),
                props:true,
                meta: {title:'搜索本店商品',routerViewKey: 'shop-page'}  //避免嵌套路由二级父组件重新渲染
            },
        ],
    },
]

const searchViews = [  //搜索页（不包括店铺内搜索）的路由
    {
        name:'searchLayer',
        path: '/search',
        component: () => import(/* webpackChunkName: "home" */ '@/layout/searchLayer.vue'),
        meta: {keepAlive: true, title: '商城搜索', routerViewKey: 'search-page'},  //避免嵌套路由二级父组件重新渲染
        redirect:'/search/inputKey',
        children:[
            {
                name:'searchInputKey',
                path: '/search/inputKey',
                component: () => import(/* webpackChunkName: "home" */ '@/views/search/inputKey.vue'),
                meta: {title:'商城搜索',keepAlive:true, routerViewKey: 'search-page'}
            },
            {
                name:'searchShop',
                path: '/search/shop',
                component: () => import(/* webpackChunkName: "home" */ '@/views/search/shop.vue'),
                meta: {title:'搜索店铺',keepAlive:true, routerViewKey: 'search-page'}
            },
            {
                name:'searchGoods',
                path: '/search/goods',
                component: () => import(/* webpackChunkName: "home" */ '@/views/search/goods.vue'),
                meta: {title:'搜索商品',keepAlive:true, routerViewKey: 'search-page'}
            },
        ],
    }
]

const discoveryViews = [  //发现页签里的页面
    {
        name:'discoveryLayer',
        path: '/discovery',
        component: () => import(/* webpackChunkName: "home" */ '@/layout/discoveryLayer.vue'),
        meta: {keepAlive: true, title: '发现', routerViewKey: 'discovery-page'},  //避免嵌套路由二级父组件重新渲染
        redirect:'/discovery/hotshop',
        children:[
            {
                name:'discoveryHotShop',
                path: '/discovery/hotshop',
                component: () => import(/* webpackChunkName: "home" */ '@/views/discovery/hotShop.vue'),
                meta: {title:'热门店铺',keepAlive:true, routerViewKey: 'discovery-page'}
            },
            {
                name:'discoveryActZone',
                path: '/discovery/actzone',
                component: () => import(/* webpackChunkName: "home" */ '@/views/discovery/actLayer.vue'),
                meta: {title:'活动专区',keepAlive:true, routerViewKey: 'discovery-page'},
                children:[
                    {
                        name:'actZoneFloor',
                        path: '/discovery/actzone/:id',
                        component: () => import(/* webpackChunkName: "home" */ '@/views/discovery/actFloorPage.vue'),
                        props:true,
                        meta: {title:'活动专区',keepAlive:false, routerViewKey: 'discovery-page'}
                    },
                ]
            },
        ],
    }
]

const favoritesViews = [  //收藏/关注里的页面
    {
        name:'favoritesLayer',
        path: '/favor',
        component: () => import(/* webpackChunkName: "home" */ '@/layout/favoritesLayer.vue'),
        meta: {keepAlive:true, title: '收藏关注', routerViewKey: 'favorites-page'},  //避免嵌套路由二级父组件重新渲染
        redirect:'/favor/offer',
        children:[
            {
                name:'favoritesOffer',
                path: '/favor/offer',
                component: () => import(/* webpackChunkName: "home" */ '@/views/favorites/offer.vue'),
                meta: {keepAlive:true,title:'收藏夹', routerViewKey: 'favorites-page'}
            },
            {
                name:'favoritesFootprint',
                path: '/favor/footprint',
                component: () => import(/* webpackChunkName: "home" */ '@/views/favorites/footprint.vue'),
                meta: {keepAlive:true,title:'浏览足迹', routerViewKey: 'favorites-page'}
            },
            {
                name:'favoritesShop',
                path: '/favor/shop',
                component: () => import(/* webpackChunkName: "home" */ '@/views/favorites/shop.vue'),
                meta: {keepAlive:true,title:'关注店铺', routerViewKey: 'favorites-page'}
            },
        ],
    }
]

const orderViews = [  //前店中“我的订单”、“订单详情”的路由
    {
        name:'orderLayer',
        path: '/order',
        component: () => import(/* webpackChunkName: "home" */ '@/layout/orderLayer.vue'),
        meta: {keepAlive: true, title: '我的订单', routerViewKey: 'order-page'},  //避免嵌套路由二级父组件重新渲染
        redirect:'/order/myOrders',
        children:[
            {
                name:'myOrders',
                path: '/order/myOrders',
                component: () => import(/* webpackChunkName: "home" */ '@/views/order/myOrders.vue'),
                meta: {title:'我的订单',keepAlive:true, routerViewKey: 'order-page'}
            },
            {
                name:'orderDetail',
                path: '/order/orderDetail',
                component: () => import(/* webpackChunkName: "home" */ '@/views/order/orderDetail.vue'),
                meta: {title:'订单详情',keepAlive:false, routerViewKey: 'order-page'}
            },
        ],
    }
]

export {
    baseViews, shopViews,searchViews,discoveryViews,favoritesViews,orderViews,
};